import { defineStore } from 'pinia';

type Numberish = string | number | undefined;

interface SysState {
  statusBar?: Numberish;
  customBar: Numberish;
}

export const useSysStore = defineStore({
  id: 'sys',
  state: (): SysState => ({
    statusBar: '',
    customBar: '',
  }),
  getters: {
    getStatusBar: (state): Numberish => {
      return state.statusBar;
    },
    getCustomBar: (state): Numberish => {
      return state.customBar;
    },
  },
  actions: {
    setStatusBar(height: Numberish) {
      this.statusBar = (+height || 20) + 'px';
    },
    setCustomBar(height: Numberish) {
      this.customBar = (+height || 60) + 'px';
    },
  },
});
